export const initRoutes = (route) => {
    let temp = formatRoutes(route)

    return temp
}

export const formatRoutes = (route) => {
    let ftRoutes = []

    route.forEach(element => {
        let {
            id,
            path,
            name,
            meta,
            children
        } = element

        let ftRoute = {}

        if (children && children instanceof Array) {
            children = formatRoutes(children)

            ftRoute = {
                id: id,
                path: path,
                name: name,
                meta: meta,
                component: import('@/views/layout/Layout'),
                children: children
            }
        } else {
            ftRoute = {
                id: id,
                path: path,
                name: name,
                meta: meta,
                component: import('@/views/temp/hello')
            }
        }

        ftRoutes.push(ftRoute)
    })
    return ftRoutes
}
